Skip to content

feat: migrate Counter to Spartan.ng UI primitives (closes #189)#190

Open
chrisjwalk-bot wants to merge 19 commits into
mainfrom
feat/spartan-counter-migration-189
Open

feat: migrate Counter to Spartan.ng UI primitives (closes #189)#190
chrisjwalk-bot wants to merge 19 commits into
mainfrom
feat/spartan-counter-migration-189

Conversation

@chrisjwalk-bot

Copy link
Copy Markdown
Collaborator

Closes #189

Summary

Replaces Angular Material in the Counter component with Spartan.ng — a ShadCN/UI-inspired library for Angular.

What changed

  • Added @spartan-ng/brain (headless behavior primitives) and lucide-angular (icon library)
  • Created libs/spartan/ — a shared library of Helm-style UI wrappers that compose Brain primitives with Tailwind styling:
    • HlmButton — wraps BrnButton with variant/size support
    • HlmInput — wraps BrnInput with MD3-aligned styling
    • HlmLabel — wraps BrnLabel
    • HlmField — wraps BrnField for form control composition
    • HlmTooltip — wraps BrnTooltip (CDK overlay-based)
  • Migrated Counter component from 6 Material imports to Spartan equivalents
  • Added @myorg/spartan TypeScript path mapping

Before / After

Aspect Material (Before) Spartan (After)
Icon buttons <button mat-icon-button> + <mat-icon>remove</mat-icon> <button hlmButton variant="ghost" size="icon-lg"> + <lucide-icon>
Submit button <button mat-flat-button color="primary"> <button hlmButton variant="default">
Form field <mat-form-field> + <mat-label> + <input matInput> <hlm-field> + <label hlmLabel> + <input hlmInput>
Tooltips matTooltip="Increment" [hlmTooltip]="'Increment'"
Icons Material Icons font (Google Fonts) Lucide SVG icons (tree-shakeable)
Styles hack ::ng-deep .mat-mdc-form-field-subscript-wrapper None needed

Verification

  • ✅ All 10 Counter tests pass with 100% coverage
  • ✅ Zero test changes needed (preserved aria-label and data-testid)
  • ✅ Dark mode rendering confirmed visually

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

7 similar comments
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

chrisjwalk-bot and others added 16 commits June 19, 2026 11:42
- Add @spartan-ng/brain (headless behavior) and lucide-angular (icons)
- Create libs/spartan/ shared library with HlmButton, HlmInput, HlmLabel, HlmField, HlmTooltip
- Migrate Counter component from 6 Material imports to Spartan equivalents
- Add @myorg/spartan TypeScript path mapping

Co-Authored-By: Claude <noreply@anthropic.com>
All 5 wrappers now have tests:
- HlmButton (6 tests): rendering, variant/size classes, anchor support
- HlmInput (4 tests): rendering, styling, id, textarea support
- HlmLabel (4 tests): rendering, styling, for attribute, input association
- HlmField (4 tests): rendering, content projection, label-input linkage
- HlmTooltip (3 tests): rendering, BrnTooltip integration

21 tests, 100% coverage — fixes CI  failure (closes #189)

Co-Authored-By: Claude <noreply@anthropic.com>
…189)

New Spartan wrappers (libs/spartan):
- HlmCheckbox — wraps BrnCheckbox
- HlmSeparator — wraps BrnSeparator
- HlmSpinner — simple SVG spinner
- 8 new spec files (29 tests, 100% coverage)

Migrated: MainToolbar, Sidenav, SidenavListItem, PageToolbarButton,
NotificationBell, NotificationList, TodoForm, TodoList, TodoPage,
Login, AuthStore (MatSnackBar → ToastService), WeatherForecast,
ForecastTable (MatTable → native table + pagination),
App shell (MatSidenav → Tailwind), Debug page.

183 tests passing across 7 projects.

Co-Authored-By: Claude <noreply@anthropic.com>
- Delete material.scss (no longer needed)
- Remove @angular/material from package.json, pnpm-workspace.yaml
- Strip Material sub-paths from both Module Federation vite configs
- Remove stale MatSnackBarModule imports from auth/weather-forecast specs
- Fix ToastComponent onDismiss visibility (private → public)
- Fix HlmCheckbox input types (unknown → boolean|string)
- Fix Lucide icon map types (unknown → LucideIconData)
- Fix root vite config inline deps (remove @angular/material)

Co-Authored-By: Claude <noreply@anthropic.com>
- HlmInput: taller (h-11), softer border (outline-variant/30), rounded-lg, primary focus ring
- HlmLabel: smaller (text-xs), semibold, tighter mb-1 spacing
- HlmCheckbox: properly sized check mark with CSS ::after pseudo-element
- ForecastTable: remove row borders, match Material 'no-line' table style, improved hover
- Add provideSpartanConfig() with tooltip defaults (dark bg, rounded, shadow)
- Wire provideSpartanConfig() into app.config.ts
- Fix curly brace lint in main-toolbar.ts

Co-Authored-By: Claude <noreply@anthropic.com>
CDK overlays render outside the app root DOM, so Tailwind utility classes
may not resolve reliably. Use a dedicated CSS class with direct CSS custom
property references instead.

Co-Authored-By: Claude <noreply@anthropic.com>
- Add page size selector (5/10/25) matching old MatPaginator
- Increase data row height (py-3.5) and font size (text-sm)
- slimmer header row (py-3)
- Add setPageSize method

Co-Authored-By: Claude <noreply@anthropic.com>
Add [data-state][data-side][role='tooltip'] selector so tooltip styles
apply even if the custom class isn't picked up by BrnTooltipContent.
Also bump font-size to 0.75rem (12px) to match Material tooltip size.

Co-Authored-By: Claude <noreply@anthropic.com>
- Row height h-14 (56px) to match --mat-table-row-item-container-height
- Header height h-12 (48px) to match --mat-table-header-container-height
- Paginator border-top for separation from table body
- Styled page size select with custom chevron arrow, hover/focus rings

Co-Authored-By: Claude <noreply@anthropic.com>
Match Material paginator layout with label + select on the left.

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove border-t from paginator (use tonal backgrounds for separation)
- Remove border from page-size select (use hover background instead)
- Remove border-b from main toolbar header

Co-Authored-By: Claude <noreply@anthropic.com>
Tailwind preflight resets button cursor to default. Explicitly set
cursor-pointer on all hlmButton elements and cursor-default when disabled.

Co-Authored-By: Claude <noreply@anthropic.com>
BrnTooltipContent always has role='tooltip' as a static host attribute.
Drop the class and data-attribute selectors which may not always be present.

Co-Authored-By: Claude <noreply@anthropic.com>
…migration

- Add visual snapshot tests (@visual tag) for all 8 pages (11 snapshots)
- Add remote Playwright config targeting Azure deployment
- Add e2e:remote script and nx target for remote testing
- Add E2E smoke tests for todos and debug pages (were missing)
- Switch fonts from Inter/Manrope to Roboto (matches Material)
- Set Material-compatible typography via Tailwind @theme:
  - --font-sans: Roboto, --font-display: Roboto
  - --leading-normal: 1.42857 (Material body line-height)
  - html font-size: 14px (Material rem base)
- Fix toast.service.spec.ts coverage threshold
- Capture Material baselines from Azure to screenshots-material/

Closes #189

Co-Authored-By: Claude <noreply@anthropic.com>
The Azure baselines were capturing 720px viewport-sized screenshots
(incomplete page load). These local baselines from the Material (main)
branch capture full-page content correctly.

Co-Authored-By: Claude <noreply@anthropic.com>
Material's all-component-themes mixin sets height: 100% on html and body
for the sidenav/toolbar layout. Without it, fullPage screenshots capture
the full content height instead of the viewport, causing 4-5x height diffs.

Co-Authored-By: Claude <noreply@anthropic.com>
@chrisjwalk chrisjwalk force-pushed the feat/spartan-counter-migration-189 branch from e8f8165 to 2dae6e1 Compare June 19, 2026 19:10
Setting font-size: 14px on html shrinks all rem-based Tailwind utilities
by 12.5%, making the entire UI look zoomed out. Material does not change
the root font-size; it only sets body text to 14px.
Move font-size to body so only body text is 14px while 1rem stays 16px.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

1 similar comment
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

chrisjwalk-bot and others added 2 commits June 19, 2026 15:17
- Toolbar 'Demo App' title: use text-xl (20px) matching --mat-toolbar-title-text-size
- Sidenav list items: use text-base for labels (was text-sm), text-sm for hints (was text-xs)
- Add E2E visual snapshot for mobile sidenav open state
- Add tracking-normal to toolbar title for proper letter spacing

Co-Authored-By: Claude <noreply@anthropic.com>
Material does not set a global body font-size — each component sizes
its own text via the typography system. The 14px override was shrinking
all body text unnecessarily.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-190.eastus2.2.azurestaticapps.net

@github-actions

Copy link
Copy Markdown

Note

Coverage shown for affected projects only. Per-file thresholds (80%) are enforced by vitest.

Code Coverage

Package Line Rate Branch Rate Complexity Health
src 100% 100% 0
src.lib 100% 100% 0
src 100% 100% 0
src.lib.home 100% 100% 0
src 100% 100% 0
src.lib.services 100% 100% 0
src.lib.state 100% 100% 0
src 100% 100% 0
src.lib.components 98% 100% 0
src.lib.services 100% 100% 0
src.lib.state 100% 100% 0
src.lib.testing 100% 100% 0
src 100% 100% 0
src.lib.components.counter 100% 100% 0
src.lib.components.counter-container 100% 100% 0
src.lib.state 100% 100% 0
src 100% 100% 0
src.lib.components.forecast-table 87% 93% 0
src.lib.components.weather-forecast 100% 100% 0
src.lib.models 100% 100% 0
src.lib.services 100% 100% 0
src.lib.state 100% 100% 0
src 100% 100% 0
src.lib.login 100% 100% 0
src.lib.state 100% 100% 0
Summary 99% (419 / 426) 99% (116 / 117) 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: migrate all Material components to Spartan.ng (ShadCN-style) UI primitives

1 participant